package com.zp.io;

import java.io.File;
import java.io.FilenameFilter;





public class FileTest5 {
	public static void main(String[] args) {
		File file = new File("D:/zp/hello");
		
		//使用匿名内部类，实现FilenameFilter接口的实例；
		String[] names = file.list(new FilenameFilter(){
			public boolean accept(File dir, String name) {
				if(name.endsWith(".java")){
					return true;
				}
				return false;
			};
		});
		
		for(String name : names){
			System.out.println(name);
		}
	}
}
